package com.zd02.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zd02.entity.BookBook;
import com.zd02.mapper.BookBookMapper;
import com.zd02.service.IBookBookService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhangdan
 * @since 2025-06-22
 */
@Service
public class BookBookServiceImpl extends ServiceImpl<BookBookMapper, BookBook> implements IBookBookService {
    @Override
    public void mapperServiceImpl () {
        BookBook b = new BookBook();
        b.setAdd_time(LocalDate.now());
        b.setBook_name("java2");
        b.setStatus(1);
        baseMapper.insert(b);
    }

    @Override
    public void serviceImpl () {
        BookBook b = new BookBook();
        b.setAdd_time(LocalDate.now());
        b.setBook_name("java3");
        b.setStatus(1);
        this.save(b);
    }

    @Override
    public List<BookBook>  selectALlPage  () {
        IPage<BookBook> page = new Page<>(1, 3);
        IPage<BookBook> userPage = this.page(page); // 调用 page 方法
        List<BookBook> userList = userPage.getRecords();
        return userList;
    }
}
